home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00114_Script_Verbetes, SubTextos utilities < prev    next >
Text File  |  1999-03-19  |  3KB  |  91 lines

  1. on listaSubTextos primLin, moveSumario
  2.   -- gLinhasSubTexto contera o numero total de linhas dos
  3.   -- subtextos
  4.   global gLinhasSubTexto, gSumarioLinha
  5.   put primLin into gSumarioLinha
  6.   put 0 into gLinhasSubTexto
  7.   put 1 into subTitulo
  8.   put 0 into textoUsado
  9.   put - primLin into linha
  10.   put the number of member 11 of castLib "Verbetes" into memTexto
  11.   put (the number of member "SubTitulos") - 1 into memSubTit
  12.   put [0, 1, 2, 15, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,¼
  13.        13, 14, 16, 17] into ordem
  14.   
  15.   repeat while subTitulo <= 17
  16.     set idx = getAt(ordem, subTitulo+1)
  17.     
  18.     -- Calcula tamanho do texto
  19.     if the type of member (memTexto + idx) = #field then
  20.       put the lineCount of member (memTexto + idx) into numLin
  21.       if numLin = 1 then
  22.         if the text of member (memTexto + idx) = "x" then
  23.           put 0 into numLin
  24.         end if
  25.       end if
  26.     else
  27.       set numLin = 0
  28.     end if
  29.     put gLinhasSubTexto + numLin into gLinhasSubTexto
  30.     
  31.     if numLin > 0 and linha + numLin > 0 and linha < 14 then
  32.       -- Ajusta posicao e tamanho do texto
  33.       set the puppet of sprite 16 + textoUsado to true
  34.       set the loc of sprite 16 + textoUsado to ¼
  35.         point(145,145+linha*16)
  36.       set the member of sprite 16 + textoUsado to¼
  37.         member (memTexto + idx)
  38.       sendSprite(16+textoUsado,#setMidia, 1, idx)
  39.       -- Controla subtitulos
  40.       if linha >= 0 then
  41.         puppetSprite 2 + textoUsado,true
  42.         set the member of sprite 2 + textoUsado to¼
  43.               (memSubTit + idx)
  44.         set the locV of sprite 2 + textoUsado to 240 + 16 * linha
  45.       else
  46.         -- Subtitulo aparece fora da tela
  47.         set the locV of sprite 2 + textoUsado to 960
  48.         puppetSprite 2 + textoUsado,true
  49.       end if
  50.       set textoUsado = textoUsado + 1      
  51.     end if
  52.     -- Proximo subTitulo, se ainda houver espaco
  53.     put subTitulo + 1 into subTitulo
  54.     set linha = linha + numLin
  55.   end repeat
  56.   
  57.   -- Apaga as linhas que porventura sobraram
  58.   repeat while textoUsado < 14
  59.     set the locV of sprite 2 + textoUsado to 960
  60.     set the locV of sprite 16 + textoUsado to 960
  61.     put textoUsado+1 into textoUsado
  62.   end repeat
  63.   
  64.   if moveSumario <> -1 then
  65.     if (gLinhasSubTexto <= 14) then
  66.       -- sumarioIndicador 0
  67.       set the visibility of sprite 33 to false
  68.       set the visibility of sprite 30 to false
  69.     else
  70.       set the visibility of sprite 33 to true
  71.       set the visibility of sprite 30 to true
  72.       sumarioIndicador gSumarioLinha * 10000 / (gLinhasSubTexto - 14)
  73.     end if
  74.   end if
  75. end
  76.  
  77. on sumarioIndicador pos
  78.   put (352 - 164) * pos / 10000 + 164 into y
  79.   set the locV of sprite 33 to y
  80. end
  81.  
  82. on sumarioScroll n
  83.   global gLinhasSubTexto, gSumarioLinha
  84.   if gSumarioLinha + n > gLinhasSubTexto - 14 then
  85.     put gLinhasSubTexto - 14 - gSumarioLinha into n
  86.   end if
  87.   if gSumarioLinha + n < 0 then
  88.     put - gSumarioLinha into n
  89.   end if
  90.   listaSubTextos gSumarioLinha + n
  91. end